package com.whw.fy.controller;

import com.whw.fy.entity.Area;
import com.whw.fy.entity.Message;
import com.whw.fy.service.AreaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags = "领域评估模块")
@RestController
@RequestMapping("/api/area")
public class AreaController {
    @Resource
    private AreaService areaService;

    @ApiOperation(value = "添加领域评估信息")
    @PostMapping("/one")
    public Message insert(Area area) {
        return areaService.insertSelective(area);
    }

    @ApiOperation(value = "删除领域")
    @DeleteMapping("/")
    public Message delete(Integer areaId) {
        return areaService.deleteByPrimaryKey(areaId);
    }

    @ApiOperation(value = "修改领域")
    @PutMapping("/")
    public Message update(Area area) {
        return areaService.updateByPrimaryKeySelective(area);
    }

    @ApiOperation(value = "获取所有领域")
    @GetMapping("/all")
    public Message selectAll(){
        return areaService.selectAll();
    }

    @ApiOperation(value = "根据领域id获取领域")
    @GetMapping("/one")
    public Message selectByPrimaryKey(Integer areaId){
        return areaService.selectByPrimaryKey(areaId);
    }


}
